import { ProfileAction } from "@/types/store"
import { EditInfo, User } from "@/types/data"

 type UserStateType={ //添加类型限制
   user:User,
   userProfile:EditInfo
 }
const initialState = { user:{},userProfile:{}}  as UserStateType 

const Profile = (state = initialState, action: ProfileAction):UserStateType => {
    switch(action.type){
        case 'profile/GET_User':
            return {...state,user:action.payload}
        case 'profile/getUserProfile':
            return {...state,userProfile:action.payload}
        default:
            return state
    }
    
}

export default Profile

